﻿using System;
using System.Diagnostics;

namespace IBNet
{
   /// <summary>
   /// A container class for an Order and a Contract.
   /// </summary>
   [DebuggerDisplay("{FullSymbol, nq} {Order.OrderType}, OrderId: {OrderId}")]
   [DebuggerStepThrough]
   public class OrderAndContract
   {
      private readonly Order _order;
      private readonly Contract _contract;

      /// <summary>
      /// Creates a new OrderAndContract with a specified Order and a specified Contract.
      /// </summary>
      /// <param name="order">The Order to store in this OrderAndContract.</param>
      /// <param name="contract">The Contract to store in this OrderAndContract.</param>
      public OrderAndContract(Order order, Contract contract)
      {
         _order = order;
         _contract = contract;
      }

      /// <summary>
      /// Gets the contained Order.
      /// </summary>
      public Order Order { get { return _order; } }

      /// <summary>
      /// Gets the contained Contract.
      /// </summary>
      public Contract Contract { get { return _contract; } }

      /// <summary>
      /// Gets the order Id of the contained Order.
      /// </summary>
      public int OrderId { get { return _order.OrderId; } }

      /// <summary>
      /// Gets the full symbol of the contained Contract.
      /// </summary>
      public string FullSymbol { get { return _contract.FullSymbol; } }
   }
}
